import React from 'react';
import 'core-js/modules/es6.string.link';

// 添加服务端静态路由 
import { StaticRouter, Switch } from 'react-router-dom';
import { renderRoutes } from 'react-router-config';
import { Provider } from 'react-redux';

const SSRRoot = (store, routes, url,context={}) => {
  return(
    <div>
      <Provider store={store}> 
        <StaticRouter
          location={url}
          context={context}
          >
          <Switch>
            { renderRoutes(routes) }
          </Switch>
        </StaticRouter>
      </Provider> 
    </div>
  )
}

export default SSRRoot;